<?php
class CdeUsersUnit extends AppModel {

	var $name = 'CdeUsersUnit';
	var $primaryKey = 'uid,cde_unit_id';
	function addNewUnit($unitid=null,$userid=null) {
		$unitExist=$this->query('SELECT * FROM cde_users_units where cde_unit_id='.$unitid.' and uid='.$userid);
		$sql='insert into cde_users_units values('.$userid.','.$unitid.')';
		if (count($unitExist)==0) {
			$this->query($sql);
		}
	}
	function delete($unitid=null,$userid=null) {
		$sql='delete from cde_users_units where uid='.$userid.' and cde_unit_id='.$unitid;
		$this->query($sql);
	}
}
?>